import React, { useContext, useEffect } from 'react';
import { Form, Row, Col, Input, Select } from 'antd';
import { ExpertsDictionaryService } from '../services/DictionaryService';
import AdminAriea from '@/components/AdminAriea';
import { TagSelectNew as TagSelect } from '@/components/TagSelectNew';
import { ExpertsUpdateContext } from '../common/ExpertsContext';
import { useRequest } from 'umi';
import { adminAreadDataGet } from '@/services/BaseLayout';
import pageStyles from '@/common/pageLayout.less';

const UpdateExpertsFormBaseInfo: React.FC<ExpertsUpdateAPI.IUpdateExpertsBaseInfo> = ({ form }) => {
  const { expertsInfo } = useContext(ExpertsUpdateContext);

  const { educateLevelList, professionalList, overseasExperienceList, talentTitleList } = ExpertsDictionaryService();

  /**获取行政区域*/
  // const areadList = useRequest(() => {
  //   return adminAreadDataGet({});
  // });

  return (
    <Row className={pageStyles['fromView-labelLengthMax']}>
      <Col span={12}>
        <Form.Item
          label="专家姓名"
          name="fullName"
          rules={[
            {
              required: true,
              message: '请输入专家姓名',
            },
          ]}
        >
          <Input placeholder="请输入" />
        </Form.Item>
      </Col>

      <Col span={12}>
        <TagSelect
          formLabel="性别"
          formName="sex"
          // formRequired={true}
          radioList={[
            {
              value: 0,
              name: '未知',
            },
            {
              value: 1,
              name: '先生',
            },
            {
              value: 2,
              name: '女士',
            },
          ]}
          defalultKeys={expertsInfo?.sex || 0}
        />
      </Col>

      <Col span={12}>
        <Form.Item
          label="所在单位"
          name="companyName"
          rules={[
            {
              required: true,
              message: '请输入所在单位',
            },
          ]}
        >
          <Input placeholder="请输入" />
        </Form.Item>
      </Col>

      <Col span={12}>
        <Form.Item label="所在地" name="addressInfo">
          <Input placeholder="请输入" />
        </Form.Item>
      </Col>

      <Col span={12}>
        <Form.Item label="职务" name="positionName">
          <Input placeholder="请输入" />
        </Form.Item>
      </Col>

      <Col span={12}>
        <Form.Item label="职称" name="rankType" rules={[{ required: true, message: '请选择职称' }]}>
          <Select
            placeholder="请选择"
            options={professionalList}
            fieldNames={{
              label: 'name',
              value: 'value',
            }}
          />
        </Form.Item>
      </Col>

      <Col span={12}>
        <Form.Item label="最高学历" name="educateLevel">
          <Select
            placeholder="请选择"
            options={educateLevelList}
            fieldNames={{
              label: 'name',
              value: 'value',
            }}
          />
        </Form.Item>
      </Col>

      <Col span={12}>
        <Form.Item label="毕业院校" name="graduateSchool">
          <Input placeholder="请输入" />
        </Form.Item>
      </Col>

      <Col span={12}>
        <Form.Item label="人才称号" name="talentType">
          <Select
            placeholder="请选择(可多选)"
            options={talentTitleList}
            fieldNames={{
              label: 'name',
              value: 'value',
            }}
            mode="multiple"
            maxTagCount={2}
            showSearch
            filterOption={(input, option: any) => (option?.name ?? '').toLowerCase().includes(input.toLowerCase())}
          />
        </Form.Item>
      </Col>

      <Col span={12}>
        <Form.Item label="海外经历" name="overseaType">
          <Select
            placeholder="请选择(可多选)"
            options={overseasExperienceList}
            fieldNames={{ label: 'name', value: 'value' }}
            mode="multiple"
            maxTagCount={2}
            showSearch
            filterOption={(input, option: any) => (option?.name ?? '').toLowerCase().includes(input.toLowerCase())}
          />
        </Form.Item>
      </Col>

      <Col span={12}>
        <Form.Item
          label="联系电话"
          name="phoneMobile"
          rules={[
            {
              required: true,
              message: '请输入联系电话',
            },
          ]}
        >
          <Input placeholder="请输入" />
        </Form.Item>
      </Col>

      <Col span={12}>
        <Form.Item label="邮箱" name="emailNum">
          <Input placeholder="请输入" />
        </Form.Item>
      </Col>
    </Row>
  );
};

export default UpdateExpertsFormBaseInfo;

{
  /* <AdminAriea
cascaderData={areadList?.data?.obj}
colSpan={12}
labelName="所在地"
placeholder={'请选择'}
formName="area"
allDataID={
  JSON.stringify(expertsInfo) !== '{}' && expertsInfo && (expertsInfo?.provinceCode || expertsInfo?.cityCode || expertsInfo?.countyCode)
    ? [expertsInfo?.provinceCode, expertsInfo?.cityCode, expertsInfo?.countyCode]
    : []
}
showSearch={true}
fieldNames={{ label: 'text', value: 'id' }}
allowClear={true}
      /> */
}

{
  /* <Col span={12}>
        <Form.Item label="办公电话" name="phoneOffice">
          <Input placeholder="请输入" />
        </Form.Item>
      </Col>
      <Col span={12}>
        <Form.Item label="备用手机" name="phoneSpare">
          <Input placeholder="请输入" />
        </Form.Item>
      </Col> */
}

{
  /* <Col span={12}>
        <Form.Item label="专家级别" name="expertLevel" rules={[{ required: true, message: '请选择专家级别' }]}>
          <Select
            placeholder="请选择"
            options={expertLevelList}
            fieldNames={{
              label: 'name',
              value: 'value',
            }}
          />
        </Form.Item>
      </Col> */
}

{
  /* <Col span={12}>
        <Form.Item label="专家类型" name="expertType" rules={[{ required: true, message: '请选择专家类型' }]}>
          <Select
            placeholder="请选择"
            options={expertsTypeList}
            fieldNames={{
              label: 'name',
              value: 'value',
            }}
          />
        </Form.Item>
      </Col> */
}
{
  /* <Row>
<Col span={12}>
    <Form.Item
        label="专家姓名"
        name="fullName"
        rules={[
            { required: true, message: '请输入专家姓名' },
        ]}
    >
        <Input placeholder="请输入专家姓名" />
    </Form.Item>
</Col>
<Col span={12}>
    <Form.Item
        label="专家类型"
        name="expertType"
        rules={[
            { required: true, message: '请选择专家类型' },
        ]}
    >
        <Select
            placeholder="请选择专家类型"
            options={expertsTypeList}
            fieldNames={{
                label: 'name',
                value: 'value'
            }}
        />
    </Form.Item>
</Col>
<Col span={12}>
    <Form.Item
        label="最高学历"
        name="educateLevel"
        rules={[
            { required: true, message: '请选择教育水平' },
        ]}
    >
        <Select
            placeholder="请选择教育水平"
            options={educateLevelList}
            fieldNames={{
                label: 'name',
                value: 'value'
            }}
        />
    </Form.Item>
</Col>
<Col span={12}>
    <Form.Item
        label="专家级别"
        name="expertLevel"
        rules={[
            { required: true, message: '请选择专家级别' },
        ]}
    >
        <Select
            placeholder="请选择专家级别"
            options={expertLevelList}
            fieldNames={{
                label: 'name',
                value: 'value'
            }}
        />
    </Form.Item>
</Col> */
}
{
  /* <Col span={12}>
    <TagSelect
        formLabel="是否启用"
        formName="isOpen"
        radioDisabled
        radioList={[
            {
                value: '1',
                name: '是',
            },
            {
                value: '0',
                name: '否',
            },
        ]}
        defalultKeys={1}
    />
</Col> */
}
{
  /* <AdminAriea
    cascaderData={areadList?.data?.obj}
    colSpan={12}
    isRequired={true}
    labelName="所在地"
    formName="area"
    allDataID={
        JSON.stringify(expertsInfo) !== '{}' && expertsInfo && (expertsInfo?.provinceCode || expertsInfo?.cityCode || expertsInfo?.countyCode)
            ? [expertsInfo?.provinceCode, expertsInfo?.cityCode, expertsInfo?.countyCode]
            : []
    }
    // areaAll={() => { }}
    showSearch={true}
    fieldNames={{ label: 'text', value: 'id' }}
    allowClear={true}
/>
<Col span={12}>
    <Form.Item
        label="所在地"
        name="addressInfo"
    >
        <Input placeholder="请输入所在住址" />
    </Form.Item>
</Col>
<Col span={12}>
    <Form.Item
        label="所在单位"
        name="companyName"
    >
        <Input placeholder="请输入所在公司" />
    </Form.Item>
</Col>
<Col span={12}>
    <Form.Item
        label="所在部门"
        name="deptName"
    >
        <Input placeholder="请输入所在部门" />
    </Form.Item>
</Col> */
}
{
  /* <Col span={12} className={'imageInfo'}>
    <Form.Item
        label="专家头像"
        name="imageInfo"
    >
        <UpdateExpertsUpload desc={'选择头像'} width={400} uploadSuccess={uploadSuccess} />
    </Form.Item>
</Col> */
}
{
  /* <Col span={12}>
    <TagSelect
        formLabel="是否在岗"
        formName="isDuty"
        radioList={[
            {
                value: '1',
                name: '是',
            },
            {
                value: '0',
                name: '否',
            },
        ]}
        defalultKeys={1}
    />
</Col>
<Col span={12}>
    <Form.Item
        label="职务"
        name="positionName"
    >
        <Input placeholder="请输入当前职位" />
    </Form.Item>
</Col>
</Row > */
}
